package com.kaishengit.dao;

import javax.inject.Named;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;

import com.kaishengit.entity.Book;
import com.kaishengit.entity.Shopcar;
import com.kaishengit.entity.User;

@Named
public class ShopcarDao extends BaseDao<Shopcar, String>{

	public Shopcar findByUserAndBook(User user, Book book) {
		Criteria c = getSession().createCriteria(Shopcar.class);
		c.add(Restrictions.eq("user",user));
		c.add(Restrictions.eq("book",book));
		return (Shopcar) c.uniqueResult();
	}

}
